
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Measure.h>
#include <Const.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Measure)
{
    TEST(should be able to display 40 TSP as 6 OZ 1 TBSP 1 TSP)
    {
        Measure volume1(40, TSP);
        ASSERT_EQ(string(" 6 OZ 1 TBSP 1 TSP"), volume1.print());
    }

    TEST(should be able to display 63430 INCH as 1 MILE 1 YARD 2 FEET 10 INCH)
    {
        Measure length(63430, INCH);
        ASSERT_EQ((" 1 MILE 1 YARD 2 FEET 10 INCH"), length.print());
    }

    TEST(should be able to display 34 INCH as 2 FEET 10 INCH)
    {
        Measure length(34, INCH);
        ASSERT_EQ((" 2 FEET 10 INCH"), length.print());
    }

    TEST(should be able to display 38 INCH as 1 YARD 2 INCH)
    {
        Measure length(38, INCH);
        ASSERT_EQ((" 1 YARD 2 INCH"), length.print());
    }

    TEST(should be able to display 48 INCH as 1 YARD 1 FEET)
    {
        Measure length(48, INCH);
        ASSERT_EQ((" 1 YARD 1 FEET"), length.print());
    }

    TEST(should be able to display 5 FEET as 1 YARD 2 FEET)
    {
        Measure length(5, FEET);
        ASSERT_EQ((" 1 YARD 2 FEET"), length.print());
    }

    TEST(should be able to display 1781 YARD as 1 MILE 21 YARD)
    {
        Measure length(1781, YARD);
        ASSERT_EQ((" 1 MILE 21 YARD"), length.print());
    }

    TEST(should be able to compare 3 OZ + 4 TBSP = 30 TSP)
    {
        Measure volume1(3, OZ);
        Measure volume2(4, TBSP);
        Measure volume3(30,TSP);
        ASSERT_TRUE(volume3 == (volume1 + volume2));
    }

        
    TEST(should be able to compare 2 OZ = 12 TSP)
    {
        Measure volume1(2, OZ);
        Measure volume2(12,TSP);
        ASSERT_TRUE(volume2  == volume1);
    }


    TEST(should be able to compare 4 OZ = 8 TBSP)
    {
        Measure volume1(4, OZ);
        Measure volume2(8,TBSP);
        ASSERT_TRUE(volume2  == volume1);
    }

    TEST(should be able to compare 4 TBSP = 12 TSP)
    {
        Measure volume1(4, TBSP);
        Measure volume2(12,TSP);
        ASSERT_TRUE(volume1  == volume2); 
    }

    TEST(should be able to compare 5 OZ + 4 TBSP != 30 TSP)
    {
        Measure volume1(5, OZ);
        Measure volume2(4, TBSP);
        Measure volume3(30,TSP);
        ASSERT_FALSE(volume3  == (volume2 + volume1));
    }

    TEST(should be able to compare 4 TBSP  != 1 FEET)
    {
        Measure volume1(4, TBSP);
        Measure length1(1, FEET);
        ASSERT_FALSE(volume1  == length1);
    }

    
    TEST(should be able to compare 3 INCH  != 3 TSP)
    {
        Measure length1(3, INCH);
        Measure volume1(3,TSP);
        ASSERT_FALSE(volume1 == length1);
    } 

    TEST(should be able to compare 5 INCH + 6 Yard != 3 TBSP + 4 OZ)
    {
        Measure length1(5, INCH);
        Measure length2(6, YARD);
        Measure volume3(3, TBSP);
        Measure volume4(4, OZ);
        ASSERT_FALSE(length2 + length1 == volume3 + volume4);
    }

    TEST(should be able to compare 7 INCH + 8 OZ != 10 TBSP + 4 MILE)
    {
        Measure length1(7, INCH);
        Measure volume2(8, OZ);
        Measure volume3(10, TBSP);
        Measure length4(4, MILE);
        ASSERT_FALSE(volume2 + length1 == volume3 + length4);
    }

    TEST(should be able to compare 2 mile = 1760 yard + 1 mile)
    {
        Measure length1(1, MILE);
        Measure length2(1760, YARD);
        Measure length3(2, MILE);
        ASSERT_TRUE(length3 == (length2 + length1));
    }


    TEST(should be able to compare 3520 yard + 1 mile = 10560 feet + 63360 inch)
    {
        Measure length1(1, MILE);
        Measure length2(3520, YARD);
        Measure length3(10560, FEET);
        Measure length4(63360,INCH);
        ASSERT_TRUE((length3 + length4) == (length2 + length1));
    }
    
    TEST(print function)
    {
        Measure length(35, INCH);
        cout << "35 INCH = " << length;

        Measure length2(38, INCH);
        cout << "38 INCH = " << length2;

        Measure length3(48, INCH);
        cout << "48 INCH = " << length3;

        Measure length4(5, FEET);
        cout << "5 FEET = " << length4;

        Measure length5(1781, YARD);
        cout << "1781 YARD = " << length5;

        Measure vol1(135, TBSP);
        cout << "135 TBSP = " << vol1;
		
    }

};

